package wangwenjun.phase2.concurrencypattern.eventbus;

import lombok.extern.slf4j.Slf4j;
import util.ThreadUtil;
import wangwenjun.phase2.concurrencypattern.eventbus.framework.EventSubscribe;

import java.util.concurrent.ThreadLocalRandom;

/**
 * @author ChangLiang
 * @date 2020/6/18
 */
@Slf4j
public class SimpleSubscriber1 {

    @EventSubscribe
    public void method1(String message) {
        ThreadUtil.sleepForMilliSeconds(ThreadLocalRandom.current().nextInt(1000,3000));
        log.info("SimpleSubscriber1#method1 message:{}",message);
    }

    @EventSubscribe(topic = "test")
    public void method2(String message) {
        ThreadUtil.sleepForMilliSeconds(ThreadLocalRandom.current().nextInt(1000,3000));
        log.info("SimpleSubscriber1#method2 message:{}",message);
    }
}
